package com.sx.jys.ui.dialog

import android.content.Context
import android.text.TextUtils
import android.view.View
import android.widget.EditText
import android.widget.TextView
import com.blankj.utilcode.util.ToastUtils
import com.hjq.bar.OnTitleBarListener
import com.hjq.bar.TitleBar
import com.sanxinsaas.nearstore.framework.util.click
import com.sos.widget.app.dialog.BaseDialog
import com.sx.jys.R

class DialogMakeSetting(context: Context,val confirm:(String?,String?)->Unit) : BaseDialog(context) {
    init {
        setContentView(R.layout.dialog_make_setting)
        setCanceledOnTouchOutside(false)
        findViewById<TitleBar>(R.id.myTitle)?.setOnTitleBarListener(object : OnTitleBarListener {
            override fun onLeftClick(v: View?) {
            }

            override fun onTitleClick(v: View?) {
            }

            override fun onRightClick(v: View?) {
                dismiss()
            }
        })
        this.findViewById<TextView>(R.id.tv_qr)?.click {
            val zy=findViewById<EditText>(R.id.ed_zy)?.text.toString()
            val zs=findViewById<EditText>(R.id.ed_zs)?.text.toString()
            if(TextUtils.isEmpty(zy)&&TextUtils.isEmpty(zs)){
                ToastUtils.showShort("请输入止盈止损数额")
            }else{
                confirm.invoke(zy,zs)
                dismiss()
            }
        }
    }
}